<!-- **************************************** 添加链接 **************************************** -->
<div id="json_add_hyperlink" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
    <div class="modal-content">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">添加链接</h4>
    </div>
    <div class="modal-body">
        <div class="input-group">
        <span class="input-group-addon">链接名称</span>
        <input type="text" id="link_data_1"  class="form-control" placeholder="百度知道">
        <span class="input-group-addon">URL名称</span>
        </div>
        <div class="input-group" style="margin:10px auto;">
        <span class="input-group-addon">链接URL</span>
        <input type="text" id="link_data_2"  class="form-control" placeholder="http://www.baidu.com/">
        <span class="input-group-addon">URL网址</span>
        </div>
        <div class="input-group">
        <span class="input-group-addon">链接描述</span>
        <textarea class="form-control" id="link_data_3"></textarea>
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="button" class="btn btn-primary" onclick="json_insert_hyperlink()">添加</button>
    </div>
    </div>
</div>
</div>
<script>
$("a[href='#json_add_hyperlink']").click(function(event) {
    $("#json_add_hyperlink").modal('show');
});
// JSON弹出框添加链接
function json_insert_hyperlink(){
    $data1 = $("#link_data_1").val();
    $data2 = $("#link_data_2").val();
    $data3 = $("#link_data_3").val();
    if($data1==''||$data2==''){
        message.add('标题和URL不能为空','error');
        return false;
    }
    $.post("/link/json_add_hyperlink",
    {
        data1 : $data1,
        data2 : $data2,
        data3 : $data3,
    },
    function(data,status){
        if(data.state=='success'){
        message.add(data.info,'success');
        $("#json_add_hyperlink").modal('hide');
        $("#link_data_1").val('');
        $("#link_data_2").val('');
        $("#link_data_3").val('');
        }else{
        message.add(data.info,'error');
        }
    }).fail(function () {
        alert('error响应，没有进入success');
    });
}
</script>
<!-- **************************************** 添加链接 **************************************** -->